This page last changed on Aug 07, 2007 by cholmes.

WMS Convenience Wrapper for KML

Overview

Standard WMS requests can be quite long and verbose. For instance like the following:

http://localhost:8080/geoserver/wms?service=WMS&request=GetMap&version=1.1.1&format=application/vnd.google-earth.kml+XML&width=1024&height=1024&srs=EPSG:4326&layers=topp:states&styles=population&bbox=-180,-90,180,90

Typing into a browser can be quite cumbersome and error prone. Not to mention repetitive as many of the parameters do not change. The KML Reflector solves this problem nicely. The reflector concept involves filling in sensible defaults for many of the paramaters of a standard WMS request so the user does not have to. Using the reflector one can shorten the above request to:

http://localhost:8080/geoserver/wms/kml_reflect?layers=topp:states

Using the KML Reflector

To use the KML reflector all one must do is specify wms/kml_reflect? as opposed to wms? in a request. The only mandatory parameter to a kml reflector call is the layers parameter. As stated above the reflector fills in sensible defaults for the rest of the parameters. The following table lists all the defaults used:

request getmap
service wms
version 1.1.1
format application/vnd.google-eartch.kml+XML
width 1024
height 1024
srs epsg:4326
bbox -180,-90,180,90
kmattr true
kmscore 50

The styles parameter is derived by using the default style as configured by GeoServer for each layer specified in the layers parameter.

Any of these defaults can be overridden when specifying the request. For instance if one wanted to specify a particular style to be used:

http://localhost:8080/geoserver/wms/kml_reflect?layers=topp:states&styles=population

Or to specify a particular bounding box:

http://localhost:8080/geoserver/wms/kml_reflect?layers=topp:states&bbox=-124.73,24.96,-66.97,49.37
Document generated by Confluence on Jan 16, 2008 23:28